package cn.springcloud.fix.demo.design.observer;

import java.util.HashSet;
import java.util.Set;

public class Beauty {

    private Set<LittleBoy> littleBoys = new HashSet<>();

    public void addLittleBoy(LittleBoy newLittleBoy) {
        littleBoys.add(newLittleBoy);
    }

    public void removeLittleBoy(LittleBoy littleBoy) {
        littleBoys.remove(littleBoy);
    }

    public void publishWechat(String msg) {
        for (LittleBoy littleBoy : littleBoys) {
            littleBoy.receivedMsg(msg);
        }
    }
}
